<header class="main-header">
    <a href="../../index2.html" class="logo"
       style="background-color: #222d32;color: #fff;border-right: none;border-bottom: 1px solid grey;">
        <span class="logo-mini">wolf</span>
        <span class="logo-lg"><b>狼途汽车门店管理平台</b></span>
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
        <!-- Sidebar toggle button-->
        <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>

        <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">
                <li class="dropdown messages-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-envelope-o btn-unreadMessage"></i>
                        <span class="label label-danger">${NOTICE_IN_SESSION.size}</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">你有${NOTICE_IN_SESSION.size}条未读公告</li>
                        <li>
                            <#list NOTICE_IN_SESSION.notices as n>
                            <ul class="menu">
                                <li>
                                    <a href="/notice/show?id=${n.id}">
                                        <div class="pull-left">
                                            <img src="/js/adminlte/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                                        </div>
                                        <h4>
                                            ${n.employee.username}
                                            <small><i class="fa fa-clock-o"></i> ${n.getMisTime()}前</small>

                                        </h4>
                                        <p>${n.title}</p>
                                    </a>
                                </li>
                            </ul>
                            </#list>
                        </li>
                        <li class="footer"><a href="/notice/unreadList">查看更多公告</a></li>
                    </ul>
                </li>


                <li class="dropdown tasks-menu">
                    <a href="#">
                        <i class="fa fa-flag-o"></i>
                    </a>
                </li>


                <li class="dropdown notifications-menu">
                    <a href="#">
                        <i class="fa fa-bell-o"></i>
                    </a>
                </li>
                <li>
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-gears"></i></a>
                    <ul class="dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close"
                        style="min-width: 100px;">
                        <li>
                            <a href="#">
                                <i class="fa fa-cog"></i>
                                个人设置
                            </a>
                        </li>
                        <li class="divider"></li>
                        <#--                        <li>-->
                        <#--                            <a href="/employee/updatePassword" id="updatePassword">-->
                        <#--                                <i class=" fa fa-user"></i>-->
                        <#--                                修改密码-->
                        <#--                            </a>-->
                        <#--                        </li>-->
                        <#--                        模态框修改密码-->
                        <li>
                            <a id="updatePassword">
                                <i class=" fa fa-user"></i>
                                修改密码
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="/empLogout">
                                <i class="fa fa-power-off"></i>
                                注销
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>

</header>
<script>


    $("#updatePassword").click(function () {
        $("#exampleModal").modal('show')
    })

    $(function () {
        $(".btn-change").click(function () {
            $.post("/employee/updatePwd", $("#changePassword").serialize(), function (data) {
                //debugger
                if (data.success) {
                    Swal.fire({
                        title: '修改成功',
                        icon: 'warning',
                        showCancelButton: true,
                        confirmButtonText: '确认',
                        cancelButtonText: '取消'
                    }).then((result) => {
                        if (result.value) { //确认
                            window.location.href = "/login.html"
                        }
                    })
                } else {
                    Swal.fire(
                        '修改失败',
                        data.msg,
                        'error'
                    )
                }
            })
        })
    })


    // $(function () {
    //     $(".btn-primary").click(function () {
    //         $.post("/employee/updatePawd", $("#sxfhdrsgh").serialize(), function (data) {
    //             if (data.success) {
    //                 Swal.fire({
    //                     title: '修改成功,请重新登录',
    //                     icon: 'success',
    //                     showCancelButton: true,
    //                     confirmButtonText: '确认',
    //                     cancelButtonText: '取消'
    //                 }).then((result) => {
    //                     // if (result.value) { //确认
    //                     window.location.href = "/login.html"
    //                     // }
    //                 })
    //             } else {
    //                 Swal.fire(
    //                     '修改失败',
    //                     data.msg,
    //                     'error'
    //                 )
    //             }
    //         })
    //     })
    // })
</script>

<#--修改密码的模态框-->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="exampleModalLabel">修改密码</h4>
            </div>
            <div class="modal-body">
                <form id="changePassword">
                    <div class="form-group">
                        <label for="recipient-name" class="control-label">原密码:</label>
                        <input type="text" class="form-control" name="oldPassword">
                    </div>
                    <div class="form-group">
                        <label for="recipient-name" class="control-label">新密码:</label>
                        <input type="text" class="form-control" name="newPassword">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary btn-change" >修改</button>
            </div>
        </div>
    </div>
</div>
